package com.mazsn.service.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.github.pagehelper.PageHelper;
import com.mazsn.mapper.UserMapper;
import com.mazsn.model.User;
import com.mazsn.service.UserService;

@Service(value = "userService")
public class UserServiceImpl implements UserService {

	@Autowired
	private UserMapper userMapper;
	
	@Override
	public int addUser(User user) {
		// TODO Auto-generated method stub
		return userMapper.insertSelective(user);
	}

	@Override
	public List<User> findAll(int pageNum, int pageSize) {
		// TODO Auto-generated method stub
		 PageHelper.startPage(pageNum, pageSize);
	     return userMapper.selectAllUser();
	}

	
	@Override
	public User findUserByUserName(String userName) {
		return userMapper.findUserByUserName(userName);
	}

}
